#include "XTcp.h"
#include <string.h>
int main(int argc, char* argv[])
{
	unsigned short port = 8099;
	if (argc>1) {
		port = atoi(argv[1]);
	}
	XTcp client;
	char buf[1024] = {0};
	char str[100] = { 0 };
	client.CreateSocket();
	client.SetBlock(true);
	int len = 0;
	if (!client.Connect("192.168.0.23", port,4000)) {
		getchar();
		return -1;
	}
	for (;;) {
		scanf("%s", str);
		client.Send(str, strlen(str)+1);
		len = client.Recv(buf, sizeof(buf));
		buf[len] = '\0';
		printf("client:%s", buf);
	}
	client.Close();
	getchar();
	return 0;
}
